var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');



var app = getApp();

Page({
  data: {
    couponList: null
  },
  onLoad: function(options) {
    var that = this;
    let userInfo = wx.getStorageSync('userInfo');
    let token = wx.getStorageSync('token');
    let user_id = wx.getStorageSync('user_id');
    if (userInfo && token) {
      wx.request({
        url: api.CouponList,
        data: {
          user_id: user_id,
        },
        header: {
          "Content-Type": "application/x-www-form-urlencoded",
        },
        method: "POST",
        success: function(res) {
          if (res.data.status === 1) {
            that.setData({
              couponList: res.data.result
            });
          }
        }
      })
    } else {
      return;
    }
  },

  onReady: function() {

  },
  onShow: function() {

  },
  onHide: function() {
    // 页面隐藏

  },
  onUnload: function() {
    // 页面关闭
  }
})